package net.lahuobao.finance.controller.registerManagement;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;

import net.lahuobao.export.datasoruce.entity.FinanceAccountDayRecord;
import net.lahuobao.export.datasoruce.entity.FinanceDetail;
import net.lahuobao.export.util.ExportFileUtil;
import net.lahuobao.finance.dao.FundChartMapper;
import net.lahuobao.finance.dao.HouseHoldMapper;
import net.lahuobao.finance.dao.registerManagementMapper;
import net.lahuobao.finance.entity.charts.FinanceAccountDayRecordEntity;
import net.lahuobao.finance.entity.charts.FinanceDetailEntity;
import net.lahuobao.finance.entity.household.HouseholdEntity;
import net.lahuobao.finance.service.household.HouseholdServiceI;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;

import java.io.IOException;
import java.net.URI;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import org.springframework.http.MediaType;
import org.springframework.web.util.UriComponentsBuilder;

/**   
 * @Title: Controller
 * @Description: 资金明细账
 * @author zhangdaihao
 * @date 2016-08-24 18:49:17
 * @version V1.0   
 *
 */
@Controller
@RequestMapping("/registerManagementController")
public class RegisterManagementController extends BaseController {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(RegisterManagementController.class);

	@Autowired
	private SystemService systemService;
	@Autowired
	private registerManagementMapper registerManagementDao;




	/**
	 * 资金明细 页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "list")
	public ModelAndView list(HttpServletRequest request) {
		return new ModelAndView("net/lahuobao/finance/registerManagement/registerManagementList");
	}


	/**
	 * easyui AJAX请求数据
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "datagrid")
	public void datagrid(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
		Map paramMap = new HashMap();//sql 参数
		String type = request.getParameter("typeval");
		String isOwner = request.getParameter("isOwnerval");
		String[] types=null;
		String[] isOwners=null;
//		if(type!=null && !type.equals("")){
//			types=type.trim().split(",");
//		}
		if(isOwner!=null && !isOwner.equals("")){
			isOwners=isOwner.trim().split(",");
		}
		
		paramMap.put("mobile",request.getParameter("mobile"));
		
		paramMap.put("fullname",request.getParameter("fullname"));
		paramMap.put("organizationName",request.getParameter("organizationName"));

		paramMap.put("validateState",request.getParameter("validateState"));
		
		paramMap.put("oValidateState",request.getParameter("oValidateState"));

		paramMap.put("phone",request.getParameter("phone"));
		
		
		paramMap.put("isOwners",isOwners);
		
		paramMap.put("regDatetime_begin",request.getParameter("regDatetime_begin"));
		
		paramMap.put("regDatetime_end",request.getParameter("regDatetime_end"));

		List<Map> list=registerManagementDao.selectRegisterManagement(paramMap,systemService.getPageBounds());//一共有多少条
	
        TagUtil.datagrid(response, pageDateGrid(list, dataGrid));

	}



}
